//
//  welcomeView.m
//  newTestGit
//
//  Created by fangjs on 16/1/26.
//  Copyright © 2016年 Hongshi. All rights reserved.
//

#import "welcomeView.h"

@interface welcomeView ()
@property (weak, nonatomic) IBOutlet UIImageView *welView;
@property (weak, nonatomic) IBOutlet UILabel *markLabel;

@end

@implementation welcomeView
//didMoveToSuperview
//startAnimaltion
+(instancetype) shareWelcomeView {
    return [[NSBundle mainBundle] loadNibNamed:@"welcomeView" owner:nil options:nil][0];
}

- (void)didMoveToSuperview {
    [super didMoveToSuperview];
    
    _welView.alpha = 0;
    _welView.hidden = NO;
    _welView.transform = CGAffineTransformMakeTranslation(0, 50);//向下偏移50
    
    [UIView animateWithDuration:0.5 animations:^{
        _welView.alpha = 1;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.2 initialSpringVelocity:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
            _welView.transform = CGAffineTransformIdentity;//还原位置
            
        } completion:^(BOOL finished) {
            _markLabel.alpha = 0;
            _markLabel.hidden = NO;
            
            [UIView animateWithDuration:2.0 animations:^{
                _markLabel.alpha = 1;
                
            } completion:^(BOOL finished) {
                [self removeFromSuperview];
                
            }];
        }];
    }];
    
    
    
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
